package ui.panel.cell {

	import com.greensock.plugins.VolumePlugin;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	import globals.Global;
	
	public class OptionCell extends Sprite {
		
		private var icon:Bitmap;
		private var handler:Function;
		private var _enabled:Boolean;

		public function OptionCell(iconType:String, callback:Function) {
			super();
			
			icon = new Bitmap(Global.assetsManager.getAssetsAsBitmapData(iconType));
			icon.x = -icon.width / 2;
			icon.y = -icon.height / 2;
			addChild(icon);
			buttonMode = true;
			
			handler = callback;
			
			addEventListener(MouseEvent.CLICK, clickHandler);
		}
		
		private function clickHandler(event:MouseEvent):void {
			if (handler != null) {
				handler();
			}
		}
		
		public function get enabled():Boolean {
			return _enabled;
		}
		
		public function set enabled(value:Boolean):void {
			_enabled = value;
			
			//TODO change icon, remove handler??
		}
	}
}